<?php /*a:1:{s:67:"D:\workspace\admin\application\admin\view\privatechat\stat_ticket_log.html";i:1747760308;}*/ ?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>

<body>

<div  class="layui-fluid">

    <div class="layui-row layui-col-space15">
        <div class="layui-col-sm6 layui-col-md3">
            <div class="layui-card" id="p_popUp_a">
                <div class="layui-card-header">
                    <font >今日累计主动发起私信人数 </font>

                </div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font"><?php echo htmlentities($today_count); ?></p>
                    <p>
                        昨日累计
                        <span class="layuiadmin-span-color"><?php echo htmlentities($yestorday_count); ?> </span>
                    </p>
                </div>
            </div>
        </div>
        <div class="layui-col-sm6 layui-col-md3">
            <div class="layui-card" id="p_popUp_b">
                <div class="layui-card-header">
                    <font >本周主动发起私信人数</font>
                </div>

                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font"><?php echo htmlentities($thisweek_count); ?></p>
                    <p>
                        上周
                        <span class="layuiadmin-span-color"><?php echo htmlentities($lastweek_count); ?></span>
                    </p>
                </div>
            </div>
        </div>
        <div class="layui-col-sm6 layui-col-md3">
            <div class="layui-card" id="p_popUp_c">
                <div class="layui-card-header">
                    <font >本月主动发起私信人数</font>
                </div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font"><?php echo htmlentities($thismonth_count); ?></p>
                    <p>
                        上月
                        <span class="layuiadmin-span-color"><?php echo htmlentities($lastmonth_count); ?></span>
                    </p>
                </div>
            </div>
        </div>
        <div class="layui-col-sm6 layui-col-md3">
            <div class="layui-card" id="p_popUp_d">
                <div class="layui-card-header">
                    <font >今日主动发起私信人数最高渠道</font>

                </div>
                <div class="layui-card-body layuiadmin-card-list">

                    <p class="layuiadmin-big-font"><?php echo htmlentities($today_source_name); ?></p>
                    <p>
                        共计
                        <span class="layuiadmin-span-color"><?php echo htmlentities($today_max_count); ?></span>
                    </p>
                </div>
            </div>
        </div>

    </div>


    <div class="layui-form layui-card-header layuiadmin-card-header-auto">
        <form name="formName" onsubmit="return false">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">渠道标识</label>
                    <div class="layui-input-inline">
                        <input type="text" name="source_key" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">渠道名称</label>
                    <div class="layui-input-inline">
                        <input type="text" name="source_name" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">选择日期</label>
                    <div class="layui-input-inline" style="width: 350px;">
                        <input type="text" name="start_time" placeholder="搜索开始时间" autocomplete="off" class="layui-input" style="width: 167px; display: inline" id="start_time_input"/>
                        -
                        <input type="text" name="end_time" placeholder="搜索截止日期" autocomplete="off" class="layui-input" style="width: 167px; display: inline" id="end_time_input"/>
                    </div>
                </div>

                <div class="layui-inline">
                    <span  class="layui-btn" id="submit"><i class="layui-icon">&#xe615;</i></span >
                </div>

            </div>
        </form>
    </div>

    <div class="layui-card">

        <div class="layui-card-body">
            <table id="LAY-plogstat-manage" lay-filter="LAY-plogstat-manage">

            </table>
        </div>
    </div>

</div>

<script src="/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/layuiadmin/'
        , version: "<?php echo config('other.ui_version'); ?>"
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(["table", 'form', 'laydate'], function () {
        var $ = layui.$
            , form = layui.form
            , table = layui.table
            , laydate = layui.laydate;


        //执行一个laydate实例
        laydate.render({
            elem: '#start_time_input',
            type: 'date'
        });
        laydate.render({
            elem: '#end_time_input',
            type: 'date'
        });


        table.render(table_conf());

        //监听搜索
        form.on('#submit', function (data) {
            var field = data.field;
            if (field.end_time || field.start_time) {
                $('.reportTimeChoice button').removeClass('btn_danger');
                field.type = 0;
            }

            if (field.end_time && field.start_time && field.end_time < field.start_time) {
                return layer.msg('结束时间必须大于开始时间', {icon: 5});
            }
            table.render(table_conf());
            //执行重载
            table.reload('LAY-plogstat-manage', {
                where: field
                , page: {
                    curr: 1   //默认从第一页开始搜索
                },
            });
        });

        function table_conf() {
            console.log("...............")
            return {
                elem: "#LAY-plogstat-manage",
                id: "#LAY-plogstat-manage",
                url: "/admin/privatechat/log_stat?"+$("#sbumitForm").serialize(),
                method:"get",
                cols: [
                    [

                        { field: "regsource_id", title: "渠道ID", width: 150, sort: true },
                        { field: "source_key", width: 150, title: "渠道标识", sort: true },
                        { field: "source_name", title: "渠道名称", width: 150, sort: true },
                        { field: "sender_count", title: "发起私信总数(去重)", width: 150, sort: true },
                        { field: "streamer_count", title: "发给主播人数(去重)", width: 150, sort: true },
                        { field: "anchor_count", title: "发给客服人数(去重)", width: 150, sort: true },
                        { field: "count", title: "总消息条数", width: 150, sort: true },
                        {
                            field: '', title: '设备', width: 100, templet: function (d) {
                                switch (d.regsource_device) {
                                    case 1:
                                        return "<span style='color:#009688'>安卓</span>";
                                    case 2:
                                        return "<span style='color:#1E9FFF'>苹果</span>";
                                    case 3:
                                        return "<span style='color:#FFB800'>PC端</span>";
                                }
                                return '';
                            }
                        }
                        , {
                        field: '', title: '地址', minWidth: 200, templet: function (d) {
                            if (!d.regsource_url) {
                                return '';
                            }
                            return '<a href="javascript:;" data-clipboard-text="" class="layui-btn layui-btn-warm layui-btn-xs copyCoverUrl" style="margin-right:10px;" title="点击复制" lay-event="copyCoverUrl">复制</a>' + d.regsource_url;
                        }
                    }
                    ],
                ],
                page: {
                    curr: 1   //默认从第一页开始搜索
                },
                limit: 20,
                height: "full-140",
                text: "对不起，加载出现异常！",
                even: true,
                response: {
                    statusName: 'code',
                    statusCode: 0,
                    msgName: 'msg',
                    countName: 'count',
                    dataName: 'list',
                },
                done: function (res, curr, count) {
                    res.list.forEach(function (item, index) {

                    });
                },
            }
        }
    });
</script>
</body>
</html>